<template>
  <uni-popup ref="popupRef" type="bottom" background-color="rgba(0,0,0,0)">
    <view v-if="props.isClose" class="dialog-header flex">
      <view class="left"></view>
      <view class="dialog-title">
        {{title}}
      </view>
      <view class="close" @click="close">
        <image src="../../static/close.svg"></image>
      </view>
    </view>
    <view v-else class="dialog-header-other flex">
      <text @click="close">取消</text>
      <text>{{otherTitle}}</text>
      <text @click="submit">确定</text>
    </view>
    <view class="dialog-content">
      <slot></slot>
    </view>
  </uni-popup>
</template>
<script setup>
  import { onMounted, ref } from 'vue'

  const props = defineProps({
		title: String,
    otherTitle: String,
    show: {
      type: Boolean,
      default: false
    },
    isClose: {
      type: Boolean,
      default: true
    },
    maskZIndex: {
      type: Number,
      default: 1002
    },
    dialogZIndex: {
      type: Number,
      default: 1003
    }
	});

  const popupRef = ref(null)

  onMounted(() => {

  })

  const open = () => {
    popupRef.value.open()
  }
  const close = () => {
    popupRef.value.close()
  }
  const submit = () => {
    
  }

  defineExpose({
		open,
		close
	});


</script>

<style lang='scss' scoped>
  .dialog-header{
    width: 100%;
    padding: 40rpx 32rpx;
    display: flex;
    justify-content: space-between;
    box-sizing: border-box;
    background-color: white;
    border-radius: 20rpx 20rpx 0 0;
    .dialog-title{
      font-size: 32rpx;
      font-family: PingFang SC-Semibold, PingFang SC;
      font-weight: 600;
      color: #222222;
      line-height: 40rpx;
    }
    .left,.close{
      width: 32rpx;
      height: 32rpx;
      image{
        width: 32rpx;
        height: 32rpx;
      }
    }
  }
  .dialog-header-other{
    width: 100%;
    justify-content: space-between;
    padding: 40rpx 32rpx;
    box-sizing: border-box;
    text{
      font-size: 32rpx;
      font-family: PingFang SC-Semibold, PingFang SC;
      font-weight: 600;
      color: #222222;
      line-height: 40rpx;
    }
    text:first-child{
      font-size: 30rpx;
      font-family: PingFang SC-Regular, PingFang SC;
      font-weight: 400;
      color: #939395;
      line-height: 40rpx;
    }
  }

  .dialog-content{
    width: 100%;
    background-color: white;
  }
</style>